public class Timer implements Runnable {

    public static int czas;

    public Timer() {
        Thread timer = new Thread(this);
        timer.start();
    }
    public void run() {
        while (true) {
            try {
            	Thread.sleep(1000);
            } catch (InterruptedException e) {
                System.out.println(e);
            }
            if (!Screen.isWin) {
            	czas++;
            }
        }
    }
}